//
//  BLSupportTableViewCell.m
//  blanket
//
//  Created by Mac on 2017/12/6.
//  Copyright © 2017年 stoneobs@icloud.com. All rights reserved.
//

#import "BLInReportTableViewCell.h"
@interface BLInReportTableViewCell()
@property(nonatomic, strong) STLabel                     *pingzhongLable;
@property(nonatomic, strong) STLabel                     *shijianLable;
@property(nonatomic, strong) STLabel                     *chukuLable;
@property(nonatomic, strong) STLabel                     *rukuLable;
@end
@implementation BLInReportTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self configSubView];
    }
    return self;
}
+ (CGFloat)cellHeight{
    return 50;
}
#pragma mark --subView
- (void)configSubView{
    self.backgroundColor = UIColor.clearColor;
    STLabel * pingzhong = [self defultlableWithTitle:@"床单1.2"];
    [pingzhong st_showLeftLine:pingzhong.height];
    pingzhong.left = 30;
    [self addSubview:pingzhong];
    STLabel * shijian = [self defultlableWithTitle:@"2017-12-06"];
    shijian.left = pingzhong.right;
    [self addSubview:shijian];
    
    STLabel * chuku = [self defultlableWithTitle:@"0"];
    chuku.left = shijian.right;
    [self addSubview:chuku];
    
    STLabel * ruku = [self defultlableWithTitle:@"0"];
    [ruku st_showRightLine:ruku.height];
    ruku.left = chuku.right;
    [self addSubview:ruku];
    
    self.pingzhongLable = pingzhong;
    self.shijianLable = shijian;
    self.rukuLable = ruku;
    self.chukuLable = chuku;
}
- (STLabel*)defultlableWithTitle:(NSString*)title{
    CGFloat sectionLableWith = (UIScreenWidth - 60)/4;
    STLabel * titleLable = [[STLabel alloc] initWithFrame:CGRectMake(0, 0, sectionLableWith, 50)
                                                     text:title
                                                textColor:BL_secendTextColor
                                                     font:11
                                              isSizetoFit:NO
                                            textAlignment:NSTextAlignmentCenter];
    //[titleLable st_showTopLine];
    [titleLable st_showBottomLine];
    titleLable.backgroundColor = UIColor.whiteColor;
    UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onSelctedLable:)];
    [titleLable addGestureRecognizer:tap];
    titleLable.userInteractionEnabled = YES;
    return titleLable;
}
- (void)onSelctedLable:(UIGestureRecognizer*)tap{
    UILabel * lable = (id)tap.view;
    [UIViewController.new.st_currentNavgationController showAlert:lable.text];
}
- (void)setModel:(BLInReportModel *)model{
    _model = model;
    self.pingzhongLable.text = model.goods_name;
    self.shijianLable.text = model.grade;
    self.chukuLable.text = model.num;
    self.rukuLable.text = model.remark;
}
@end
